﻿using System;

namespace WorkLogger.Client {
	public static class TimeSpanFormatHelper {
		public static string FormatDuration(TimeSpan time) {
			string format = "";

			if (time.Days != 0) {
				format += string.Format("{0} д.", time.Days);
			}

			if (time.Hours != 0) {
				format += string.Format(" {0} ч.", time.Hours);
			}

			if (time.Minutes != 0) {
				format += string.Format(" {0} мин.", time.Minutes);
			}

			return format.Trim();
		}

		public static string FormatTime(TimeSpan time) {
			return string.Format("{0} ч. {1:00} мин.", time.Hours, time.Minutes);
		}
	}
}